package com.pug.authentication.rest;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xq.pug.common.result.R;

import java.util.HashMap;
import java.util.Map;

/**
 * @author RenGaoshuai
 * @date 2023/7/11 13:27
 * @description
 */
@RestController
@Slf4j
public class HelloController {

    @GetMapping("/hello")
    public R hello() {
        return R.ofSuccess("hello");
    }

    @GetMapping("/admin")
    public R admin() {
        return R.ofSuccess("hello admin");
    }

    @GetMapping("/api/oauth1/map")
    public R oauth1() {
        Map<String, Object> param = new HashMap<>();
        param.put("id", 123);
        param.put("name", "测试名称");
        param.put("type", 26);

        return R.ofSuccess(param);
    }

    @GetMapping("/oauth2/map")
    public R oauth2() {
        Map<String, Object> param = new HashMap<>();
        param.put("id", 123);
        param.put("name", "测试名称");
        param.put("type", 26);

        return R.ofSuccess(param);
    }

    @PostMapping("/api/test/t1")
    public R t1() {
        System.out.println("t1访问成功");

        return R.ofSuccess();
    }

    @GetMapping("/api/test/t2")
    public R t2() {
        System.out.println("t2访问成功");
        return R.ofSuccess();
    }

}
